from lib.constant.lib_constant import LibConstant
from lib.handler.logger import Logger
from lib.property.logger_property import LoggerProperty


class LoggerFactory:
    API = LibConstant.SERVER_API
    DOWN = LibConstant.SERVER_DOWN
    LOGIN = LibConstant.SERVER_LOGIN
    SEARCH = LibConstant.SERVER_SEARCH

    @staticmethod
    def getLogger(class_name, _type=LoggerProperty.DEFAULT):
        return LoggerFactory.handler_logger(class_name, _type)

    @staticmethod
    def handler_logger(class_name, _type):
        logger = Logger(class_name, _type)
        from lib.handler.logger_handler import LoggerHandler
        LoggerHandler.handler_class.setdefault(class_name, logger)
        return logger
